const { ipcMain, BrowserWindow, Notification } = require("electron");

ipcMain.on("hello", (event, arg) => {
  console.log("hello received");
  event.sender.send("hello-reply", "hello-reply");
});

ipcMain.on("login", (event, arg) => {
  let win = BrowserWindow.getFocusedWindow();
  win.maximize();
});

ipcMain.on("mini", (event, arg) => {
  let win = BrowserWindow.getFocusedWindow();
  win.unmaximize();
});

ipcMain.on("max", (event, arg) => {
  let win = BrowserWindow.getFocusedWindow();
  win.maximize()
});

ipcMain.on('notice', (event, arg) => {
  console.log('notice')
  if (Notification.isSupported()) {
    event.reply('notSupported', '不支持')
  }
  const notice = new Notification({
    title: 'test'
  })
  notice.show()
})